package com.pig.util;
//作用:指定系统返回值VO对象，与前端交互
public class SysResult {
    private Integer status;//200成功，201失败
    private String msg;     //服务器返回提示信息
    private Object data;

    public static SysResult fail(){
        return new SysResult(201,"服务器调用失败",null);
    }
    public static SysResult success(){
        return new SysResult(200,"服务器调用成功",null);
    }
    public static SysResult success(Object data){
        return new SysResult(200,"服务器调用成功",data);
    }
    public static SysResult success(String msg,Object data){
        return new SysResult(200,msg,data);
    }
    public static SysResult success(String msg) {
        return new SysResult(200, msg);
    }
    public static SysResult fail(Throwable e) {
        return new SysResult(201, e.getMessage());
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public SysResult(Integer status, String msg, Object data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }
    public SysResult(Integer status, String msg) {
        this.status = status;
        this.msg = msg;
    }

}
